package com.ws.function;

import com.sun.org.apache.xpath.internal.operations.Or;

/*
关于变量的赋值

如果变量是基本数据类型，此时赋值的是变量所保存的数据值
如果变量是引用数据类型，此时赋值的是变量所保存的数据的地址值

 */
public class ValueTransferTest {
    public static void main(String[] args) {

        System.out.println("**********基本数据类型：************");
        int m = 10;
        int n = m;
        System.out.println("m = " + m + ", n = " + n);//m = 10, n = 10

        n = 20;
        System.out.println("m = " + m + ", n = " + n);//m = 10, n = 20

        System.out.println("***********引用数据类型：************");
        Order o1 = new Order();
        o1.id = 1001;
        Order o2 = o1;
        System.out.println("o1 = " + o1.id + ", o2 = " + o2.id);//o1 = 1001, o2 = 1001

        o2.id = 1002;
        System.out.println("o1 = " + o1.id + ", o2 = " + o2.id);//o1 = 1002, o2 = 1002
    }
}

class Order {
    int id;
}